import java.util.Scanner;

public class PrintGreetings {
    public static void main(String[] args) {
        System.out.println("欢迎使⽤问候语打印程序！");
        System.out.println("您可以输⼊任意名字来获取问候语，输⼊exit退出程序。");
        printGreeting();
    }

    public static void printGreeting() {
        Scanner scanner = new Scanner(System.in);
        String name;
        do {
            System.out.println("请输入您的名字(输入exit退出程序：");
            name = scanner.nextLine();
            if (!name.equalsIgnoreCase("exit")) {
                System.out.println("你好，" + name + "!");
            }
        } while (!name.equalsIgnoreCase("exit"));
        System.out.println("程序已退出，再⻅！");
        System.out.println("你好,"+ name +"!");
    }
}
